package com.inspur.edp.common.expr.expresses.calculate;


import com.inspur.edp.common.expr.exception.ExpressException;

/**
 * @author lizhaorui
 * @description TODO
 * @date 2024/11/28 15:30
 */
public enum CalculateOperator {

    Plus("Plus"),
    Minus("Minus"),
    Multiply("Multiply"),
    Divide("Divide");

    private String operator;

    CalculateOperator(String operator) {
        this.operator = operator;
    }

    public String convertString() {
        return this.operator;
    }

    public String toDSL() {
        switch (operator) {
            case "Plus": {
                return "+";
            }
            case "Minus": {
                return "-";
            }
            case "Multiply": {
                return "*";
            }
            case "Divide": {
                return "/";
            }
            default:
                throw new ExpressException(String.format("operate %s not support.", operator));
        }
    }

}
